package com.mobile.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hsnn.medstgmini.sys.model.SysUser;
import com.hsnn.medstgmini.sys.service.SysUserManager;
import com.hsnn.medstgmini.util.Pagination;

/**
 * 注册
 * @author Administrator
 *
 */

@Controller
public class MobileRegisterController {

	private static final Logger log = Logger.getLogger(MobileRegisterController.class);
	

	@Autowired
	private SysUserManager userManager;

	@Autowired
	private HttpSession session;
	
    @Value("#{sysProp['captcha.enable']}")
    private String captchaEnable;
    
	/**
	 * @category 跳转登陆页面
	 * @date 2015年6月12日
	 * @return
	 */
	@RequestMapping("/mobile/register")
	public String login(HttpServletRequest request) {
		return "/mobile/register";
	}

	@RequestMapping("/mobile/registerUser")
	@ResponseBody
	public Pagination registerUser(SysUser user) {
		log.info(user.toString());
		Pagination page = new Pagination();
		if (null != user) {
			try {
				userManager.addZUser(user);
				page.setSuccess(true);
			} catch (Exception e) {
				page.setSuccess(false);
			}
		}
		return page;
	}

}
